#include "UiLanguageMidBar.h"
#ifdef MERGER_APP_TO_SHELL
	extern HINSTANCE g_SDHResModuleHandle;
#endif
UiLanguageMidBar::UiLanguageMidBar()
:m_CurrentLanguage(LANGUAGE_DOWNBAR_ENGLISH)
{
}

UiLanguageMidBar::~UiLanguageMidBar()
{
}

BOOL UiLanguageMidBar::InitUiWin(void)
{
	BOOL bRtn = FALSE;
//	SetWindowLong(m_hWnd, GWL_USERDATA, (LONG) this);
	LoadiInterItem();
	InitImages();
	return bRtn;
}

void UiLanguageMidBar::PaintWin(HDC hdc, RECT* prcWin, RECT* prcUpdate)
{
//	m_MidBarBG->Draw(hdc, prcWin, false, false);
}

int UiLanguageMidBar::OnLButtonDown(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonDown(fwKeys, xPos, yPos);

}

int UiLanguageMidBar::OnLButtonUp(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonUp(fwKeys, xPos, yPos);

}

void UiLanguageMidBar::LoadiInterItem()
{
//jdhuang 20120818
#ifndef MERGER_APP_TO_SHELL
	m_MidBarBG = ImagingHelper::GetImageObject(MzGetInstanceHandle(), 1063);
#else
//	m_MidBarBG = ImagingHelper::GetImageObject(g_SDHResModuleHandle, 3063);
#endif
	RECT rtPicLanguage = {249, 21, 551, 242};
	m_PicLanguage[LANGUAGE_DOWNBAR_ENGLISH].SetID(7100);
	m_PicLanguage[LANGUAGE_DOWNBAR_ENGLISH].SetPos(rtPicLanguage.left, rtPicLanguage.top,
		rtPicLanguage.right - rtPicLanguage.left,
		rtPicLanguage.bottom - rtPicLanguage.top);
    m_PicLanguage[LANGUAGE_DOWNBAR_ENGLISH].SetPaintMode( MZ_PAINTMODE_NORMAL);
    m_PicLanguage[LANGUAGE_DOWNBAR_ENGLISH].LoadImage(g_SDHResModuleHandle,RT_RCDATA,MAKEINTRESOURCE(8003));

	m_PicLanguage[LANGUAGE_DOWNBAR_CHINESE].SetID(7101);
	m_PicLanguage[LANGUAGE_DOWNBAR_CHINESE].SetPos(rtPicLanguage.left, rtPicLanguage.top,
		rtPicLanguage.right - rtPicLanguage.left,
		rtPicLanguage.bottom - rtPicLanguage.top);
    m_PicLanguage[LANGUAGE_DOWNBAR_CHINESE].SetPaintMode( MZ_PAINTMODE_NORMAL);
    m_PicLanguage[LANGUAGE_DOWNBAR_CHINESE].LoadImage(g_SDHResModuleHandle,RT_RCDATA,MAKEINTRESOURCE(8006));

	m_PicLanguage[LANGUAGE_DOWNBAR_ARAB].SetID(7102);
	m_PicLanguage[LANGUAGE_DOWNBAR_ARAB].SetPos(rtPicLanguage.left, rtPicLanguage.top,
		rtPicLanguage.right - rtPicLanguage.left,
		rtPicLanguage.bottom - rtPicLanguage.top);
    m_PicLanguage[LANGUAGE_DOWNBAR_ARAB].SetPaintMode( MZ_PAINTMODE_NORMAL);
    m_PicLanguage[LANGUAGE_DOWNBAR_ARAB].LoadImage(g_SDHResModuleHandle,RT_RCDATA,MAKEINTRESOURCE(8009));

	m_PicLanguage[LANGUAGE_DOWNBAR_RUSSIA].SetID(7103);
	m_PicLanguage[LANGUAGE_DOWNBAR_RUSSIA].SetPos(rtPicLanguage.left, rtPicLanguage.top,
		rtPicLanguage.right - rtPicLanguage.left,
		rtPicLanguage.bottom - rtPicLanguage.top);
    m_PicLanguage[LANGUAGE_DOWNBAR_RUSSIA].SetPaintMode( MZ_PAINTMODE_NORMAL);
    m_PicLanguage[LANGUAGE_DOWNBAR_RUSSIA].LoadImage(g_SDHResModuleHandle,RT_RCDATA,MAKEINTRESOURCE(8012));

	m_PicLanguage[LANGUAGE_DOWNBAR_PORTUGAL].SetID(7104);
	m_PicLanguage[LANGUAGE_DOWNBAR_PORTUGAL].SetPos(rtPicLanguage.left, rtPicLanguage.top,
		rtPicLanguage.right - rtPicLanguage.left,
		rtPicLanguage.bottom - rtPicLanguage.top);
    m_PicLanguage[LANGUAGE_DOWNBAR_PORTUGAL].SetPaintMode( MZ_PAINTMODE_NORMAL);
    m_PicLanguage[LANGUAGE_DOWNBAR_PORTUGAL].LoadImage(g_SDHResModuleHandle,RT_RCDATA,MAKEINTRESOURCE(8015));

	m_PicLanguage[LANGUAGE_DOWNBAR_IRAN].SetID(7105);
	m_PicLanguage[LANGUAGE_DOWNBAR_IRAN].SetPos(rtPicLanguage.left, rtPicLanguage.top,
		rtPicLanguage.right - rtPicLanguage.left,
		rtPicLanguage.bottom - rtPicLanguage.top);
    m_PicLanguage[LANGUAGE_DOWNBAR_IRAN].SetPaintMode( MZ_PAINTMODE_NORMAL);
    m_PicLanguage[LANGUAGE_DOWNBAR_IRAN].LoadImage(g_SDHResModuleHandle,RT_RCDATA,MAKEINTRESOURCE(8018));

	AddChild(&m_PicLanguage[m_CurrentLanguage]);

	
}
void UiLanguageMidBar::ChangeChildPicture(DWORD dwLanguage)
{
	if(dwLanguage != m_CurrentLanguage)
	{
		RemoveChild(&m_PicLanguage[m_CurrentLanguage]);
		AddChild(&m_PicLanguage[dwLanguage]);
		m_CurrentLanguage = dwLanguage;
		Invalidate();
	}
}
BOOL UiLanguageMidBar::InitImages()
{
/*
	HDC hDC = GetDC(m_hWnd);
//jdhuang

	RECT rcClient = GetClientRect();
//	GetClientRect(m_hWnd, &rcClient);

	m_hBakDC = CreateCompatibleDC(hDC);

	m_hBitmapBakDC = CreateCompatibleBitmap(hDC, RECT_WIDTH(rcClient), RECT_HEIGHT(rcClient));
	SelectObject(m_hBakDC, m_hBitmapBakDC);

	//jdhuang 20090616
//	HDC hMemDc = CreateCompatibleDC(m_hBakDC);

	if(m_MidBarBG)
	{
		m_MidBarBG->Draw(m_hBakDC, &rcClient, false, false);
//		DeleteDC(hMemDc);
	}
	ReleaseDC(m_hWnd, hDC);
*/
	return TRUE;
}
void UiLanguageMidBar::DeleteImages()
{
}